package com.xzlf.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean;

@Configuration
public class ThreadPoolConfig {

    @Bean
    public ScheduledExecutorFactoryBean scheduledExecutorFactoryBean(){
        ScheduledExecutorFactoryBean scheduledExecutorFactoryBean = new ScheduledExecutorFactoryBean();
        scheduledExecutorFactoryBean.setPoolSize(5);
        scheduledExecutorFactoryBean.setThreadNamePrefix("I'm time task thread - ");
        return scheduledExecutorFactoryBean;
    }
}
